package org.tech4j.common.core.sign.extractor.parse;

import jakarta.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.tuple.Triple;
import org.tech4j.common.spi.ExtensionLoader;

import java.util.Map;

/**
 * @program: tech4j-common
 * @description:
 * @author: YuKai Fan
 * @create: 2025/3/2 20:59
 **/
public class ParseDataFactory {

    /**
     * new instance ParseData
     * @param paramType paramType
     * @return ParseData
     */
    public static ParseData newInstance(final String paramType) {
        return ExtensionLoader.getExtensionLoader(ParseData.class).getJoin(paramType);
    }

    /**
     * parse data
     * @param paramType paramType
     * @param paramKey paramKey
     * @param request request
     * @return triple
     */
    public static Triple<Map<String, Object>, String, String> parse(String paramType, String paramKey, HttpServletRequest request) {
        return newInstance(paramType).parse(paramType, paramKey, request);
    }
}
